﻿using System.Net.Sockets;
using RemoteDesktop.Client.Data;

namespace RemoteDesktop.Client.Core
{
    /// <summary>
    /// Processes a remote connection session.
    /// </summary>
    internal class Transmitter
    {
        //**************************************************
        //
        // Dependencies
        //
        //**************************************************

        #region Dependencies

        /// <summary>
        /// Gets config of the client-side.
        /// </summary>
        private readonly ClientConfig _config;

        /// <summary>
        /// Gets the logger instance.
        /// </summary>
        private readonly ILog _log;

        /// <summary>
        /// Gets the associated TCP client.
        /// </summary>
        private TcpClient _client;

        #endregion


        //**************************************************
        //
        // Constants
        //
        //**************************************************

        #region Constants

        /// <summary>
        /// Gets buffer size in bytes.
        /// </summary>
        private const int BufferSize = 4096;

        #endregion



        //**************************************************
        //
        // Constructors
        //
        //**************************************************

        #region Constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="T:System.Object"/> class.
        /// </summary>
        public Transmitter(ClientConfig config, ILog log, TcpClient client)
        {
            _config = config;
            _log = log;
            _client = client;
        }

        #endregion


        //**************************************************
        //
        // Private variables
        //
        //**************************************************

        #region Private variables

        /// <summary>
        /// Gets buffer for reading data from remote desktop client.
        /// </summary>
        private readonly byte[] _readBuffer = new byte[BufferSize];

        /// <summary>
        /// Gets buffer for reading data from remote desktop client.
        /// </summary>
        private readonly byte[] _readBuffer = new byte[BufferSize];

        #endregion



        //**************************************************
        //
        // Public methods
        //
        //**************************************************

        #region Public methods

        /// <summary>
        /// Starts transmission.
        /// </summary>
        public void Start()
        {
            // read data
            
        }

        #endregion


        //**************************************************
        //
        // Private methods
        //
        //**************************************************

        #region Private methods
        
        /// <summary>
        /// Begins reading a chunk of data.
        /// </summary>
        private void BeginReadData()
        {
            //_client.GetStream().BeginRead()
            ConcurrentQueue<int>
        }

        #endregion

    }
}